@genspectrum/dashboard-components 1.13.0 → 1.14.1

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 (27) hide show
  1. package/custom-elements.json +393 -2
  2. package/dist/components.d.ts +170 -53
  3. package/dist/components.js +702 -164
  4. package/dist/components.js.map +1 -1
  5. package/dist/util.d.ts +190 -55
  6. package/package.json +1 -1
  7. package/src/lapisApi/lapisTypes.ts +1 -1
  8. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -1
  9. package/src/preact/queriesOverTime/__mockData__/defaultMockData/queriesOverTime.json +32 -0
  10. package/src/preact/queriesOverTime/__mockData__/manyQueries.json +128 -0
  11. package/src/preact/queriesOverTime/__mockData__/request1800s.json +16 -0
  12. package/src/preact/queriesOverTime/__mockData__/withGaps.json +52 -0
  13. package/src/preact/queriesOverTime/getFilteredQueriesOverTimeData.ts +85 -0
  14. package/src/preact/queriesOverTime/queries-over-time-filter.tsx +25 -0
  15. package/src/preact/queriesOverTime/queries-over-time-grid-tooltip.stories.tsx +134 -0
  16. package/src/preact/queriesOverTime/queries-over-time-grid-tooltip.tsx +123 -0
  17. package/src/preact/queriesOverTime/queries-over-time.stories.tsx +481 -0
  18. package/src/preact/queriesOverTime/queries-over-time.tsx +304 -0
  19. package/src/utilEntrypoint.ts +1 -0
  20. package/src/web-components/visualization/gs-mutations-over-time.spec-d.ts +3 -0
  21. package/src/web-components/visualization/gs-mutations-over-time.tsx +1 -1
  22. package/src/web-components/visualization/gs-queries-over-time.spec-d.ts +38 -0
  23. package/src/web-components/visualization/gs-queries-over-time.stories.ts +288 -0
  24. package/src/web-components/visualization/gs-queries-over-time.tsx +154 -0
  25. package/src/web-components/visualization/index.ts +1 -0
  26. package/standalone-bundle/dashboard-components.js +8510 -8069
  27. package/standalone-bundle/dashboard-components.js.map +1 -1
@@ -2962,7 +2962,7 @@
2962
2962
  "kind": "field",
2963
2963
  "name": "hideGaps",
2964
2964
  "type": {
2965
- "text": "boolean"
2965
+ "text": "boolean | undefined"
2966
2966
  },
2967
2967
  "default": "false",
2968
2968
  "description": "If true, date ranges with no data will be hidden initially; if false, not.\nCan be switched with a button in the toolbar.",
@@ -3083,7 +3083,7 @@
3083
3083
  {
3084
3084
  "name": "hideGaps",
3085
3085
  "type": {
3086
- "text": "boolean"
3086
+ "text": "boolean | undefined"
3087
3087
  },
3088
3088
  "default": "false",
3089
3089
  "description": "If true, date ranges with no data will be hidden initially; if false, not.\nCan be switched with a button in the toolbar.",
@@ -4136,6 +4136,389 @@
4136
4136
  }
4137
4137
  ]
4138
4138
  },
4139
+ {
4140
+ "kind": "javascript-module",
4141
+ "path": "src/web-components/visualization/gs-queries-over-time.spec-d.ts",
4142
+ "declarations": [],
4143
+ "exports": []
4144
+ },
4145
+ {
4146
+ "kind": "javascript-module",
4147
+ "path": "src/web-components/visualization/gs-queries-over-time.stories.ts",
4148
+ "declarations": [
4149
+ {
4150
+ "kind": "variable",
4151
+ "name": "meta",
4152
+ "type": {
4153
+ "text": "Meta<Required<QueriesOverTimeProps>>"
4154
+ },
4155
+ "default": "{ title: 'Visualization/Queries over time', component: 'gs-queries-over-time', argTypes: { lapisFilter: { control: 'object' }, queries: { control: 'object' }, views: { options: ['grid'], control: { type: 'check' }, }, width: { control: 'text' }, height: { control: 'text' }, granularity: { options: ['day', 'week', 'month', 'year'], control: { type: 'radio' }, }, lapisDateField: { control: 'text' }, initialMeanProportionInterval: { control: 'object' }, hideGaps: { control: 'boolean' }, pageSizes: { control: 'object' }, customColumns: { control: 'object' }, }, args: { lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-04-30' }, queries: [ { displayLabel: 'S:F456L (single mutation)', countQuery: 'S:456L', coverageQuery: '!S:456N', }, { displayLabel: 'R346T + F456L (combination)', countQuery: 'S:346T & S:456L', coverageQuery: '!S:346N & !S:456N', }, { displayLabel: 'C22916T or T22917G (nucleotide OR)', countQuery: 'C22916T | T22917G', coverageQuery: '!22916N & !22917N', }, ], views: ['grid'], width: '100%', granularity: 'month', lapisDateField: 'date', initialMeanProportionInterval: { min: 0, max: 1 }, hideGaps: false, pageSizes: [10, 20, 30, 40, 50], }, parameters: withComponentDocs({ componentDocs: { opensShadowDom: true, expectsChildren: false, codeExample, }, fetchMock: { mocks: [ { matcher: { url: `${LAPIS_URL}/component/queriesOverTime`, body: { filters: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-04-30', }, queries: [ { displayLabel: 'S:F456L (single mutation)', countQuery: 'S:456L', coverageQuery: '!S:456N', }, { displayLabel: 'R346T + F456L (combination)', countQuery: 'S:346T & S:456L', coverageQuery: '!S:346N & !S:456N', }, { displayLabel: 'C22916T or T22917G (nucleotide OR)', countQuery: 'C22916T | T22917G', coverageQuery: '!22916N & !22917N', }, ], dateRanges: [ { dateFrom: '2024-01-01', dateTo: '2024-01-31' }, { dateFrom: '2024-02-01', dateTo: '2024-02-29' }, { dateFrom: '2024-03-01', dateTo: '2024-03-31' }, { dateFrom: '2024-04-01', dateTo: '2024-04-30' }, ], dateField: 'date', }, matchPartialBody: true, response: { status: 200, body: mockDefaultQueriesOverTime, }, }, }, ], }, }), tags: ['autodocs'], }"
4156
+ },
4157
+ {
4158
+ "kind": "variable",
4159
+ "name": "Default",
4160
+ "type": {
4161
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4162
+ },
4163
+ "default": "{ ...Template, }"
4164
+ },
4165
+ {
4166
+ "kind": "variable",
4167
+ "name": "WithFixedHeight",
4168
+ "type": {
4169
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4170
+ },
4171
+ "default": "{ ...Template, args: { ...Template.args, height: '700px', }, }"
4172
+ },
4173
+ {
4174
+ "kind": "variable",
4175
+ "name": "ByWeek",
4176
+ "type": {
4177
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4178
+ },
4179
+ "default": "{ ...Template, args: { ...Template.args, lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-02-11' }, granularity: 'week', }, parameters: { fetchMock: { mocks: [ { matcher: { url: `${LAPIS_URL}/component/queriesOverTime`, body: { filters: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-02-11', }, dateRanges: [ { dateFrom: '2024-01-15', dateTo: '2024-01-21' }, { dateFrom: '2024-01-22', dateTo: '2024-01-28' }, { dateFrom: '2024-01-29', dateTo: '2024-02-04' }, { dateFrom: '2024-02-05', dateTo: '2024-02-11' }, ], }, matchPartialBody: true, response: { status: 200, body: mockDefaultQueriesOverTime, }, }, }, ], }, }, }"
4180
+ },
4181
+ {
4182
+ "kind": "variable",
4183
+ "name": "WithCustomColumns",
4184
+ "type": {
4185
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4186
+ },
4187
+ "default": "{ ...Template, args: { ...Template.args, customColumns: [ { header: 'Jaccard Index', values: { 'S:F456L (single mutation)': 0.75, 'R346T + F456L (combination)': 0.92, 'C22916T or T22917G (nucleotide OR)': 0.58, }, }, ], }, }"
4188
+ },
4189
+ {
4190
+ "kind": "variable",
4191
+ "name": "HideGaps",
4192
+ "type": {
4193
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4194
+ },
4195
+ "default": "{ ...Template, args: { ...Template.args, lapisFilter: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-07-10' }, queries: [ { displayLabel: 'S:F456L', countQuery: 'S:456L', coverageQuery: '!S:456N', }, { displayLabel: 'S:R346T', countQuery: 'S:346T', coverageQuery: '!S:346N', }, { displayLabel: 'S:Q493E', countQuery: 'S:493E', coverageQuery: '!S:493N', }, ], hideGaps: true, }, parameters: { fetchMock: { mocks: [ { matcher: { url: `${LAPIS_URL}/component/queriesOverTime`, body: { filters: { pangoLineage: 'JN.1*', dateFrom: '2024-01-15', dateTo: '2024-07-10' }, dateRanges: [ { dateFrom: '2024-01-01', dateTo: '2024-01-31' }, { dateFrom: '2024-02-01', dateTo: '2024-02-29' }, { dateFrom: '2024-03-01', dateTo: '2024-03-31' }, { dateFrom: '2024-04-01', dateTo: '2024-04-30' }, { dateFrom: '2024-05-01', dateTo: '2024-05-31' }, { dateFrom: '2024-06-01', dateTo: '2024-06-30' }, { dateFrom: '2024-07-01', dateTo: '2024-07-31' }, ], }, matchPartialBody: true, response: { status: 200, body: mockWithGapsQueriesOverTime, }, }, }, ], }, }, }"
4196
+ },
4197
+ {
4198
+ "kind": "variable",
4199
+ "name": "SmallWidth",
4200
+ "type": {
4201
+ "text": "StoryObj<Required<QueriesOverTimeProps>>"
4202
+ },
4203
+ "default": "{ ...Template, args: { ...Template.args, width: '300px', }, }"
4204
+ }
4205
+ ],
4206
+ "exports": [
4207
+ {
4208
+ "kind": "js",
4209
+ "name": "default",
4210
+ "declaration": {
4211
+ "name": "meta",
4212
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4213
+ }
4214
+ },
4215
+ {
4216
+ "kind": "js",
4217
+ "name": "Default",
4218
+ "declaration": {
4219
+ "name": "Default",
4220
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4221
+ }
4222
+ },
4223
+ {
4224
+ "kind": "js",
4225
+ "name": "WithFixedHeight",
4226
+ "declaration": {
4227
+ "name": "WithFixedHeight",
4228
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4229
+ }
4230
+ },
4231
+ {
4232
+ "kind": "js",
4233
+ "name": "ByWeek",
4234
+ "declaration": {
4235
+ "name": "ByWeek",
4236
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4237
+ }
4238
+ },
4239
+ {
4240
+ "kind": "js",
4241
+ "name": "WithCustomColumns",
4242
+ "declaration": {
4243
+ "name": "WithCustomColumns",
4244
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4245
+ }
4246
+ },
4247
+ {
4248
+ "kind": "js",
4249
+ "name": "HideGaps",
4250
+ "declaration": {
4251
+ "name": "HideGaps",
4252
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4253
+ }
4254
+ },
4255
+ {
4256
+ "kind": "js",
4257
+ "name": "SmallWidth",
4258
+ "declaration": {
4259
+ "name": "SmallWidth",
4260
+ "module": "src/web-components/visualization/gs-queries-over-time.stories.ts"
4261
+ }
4262
+ }
4263
+ ]
4264
+ },
4265
+ {
4266
+ "kind": "javascript-module",
4267
+ "path": "src/web-components/visualization/gs-queries-over-time.tsx",
4268
+ "declarations": [
4269
+ {
4270
+ "kind": "class",
4271
+ "description": "## Context\n\nThis component displays arbitrary LAPIS queries over time for a dataset.\nEach query consists of a displayLabel (optional), countQuery (string for counting matches),\nand coverageQuery (string for determining the coverage/denominator).\nThe shown date range is determined by the available dates in the dataset.\n\n## Views\n\n### Grid View\n\nThe grid view shows the proportion for each query over date ranges.\nProportions are calculated as count/coverage for each time period.\n\nUsers can filter the displayed rows by mean proportion via a slider in the toolbar.\nThe mean proportion of each row is calculated over the whole data range that the component displays.",
4272
+ "name": "QueriesOverTimeComponent",
4273
+ "members": [
4274
+ {
4275
+ "kind": "field",
4276
+ "name": "lapisFilter",
4277
+ "type": {
4278
+ "text": "Record<string, string | string[] | number | null | boolean | undefined> & {\n nucleotideMutations?: string[];\n aminoAcidMutations?: string[];\n nucleotideInsertions?: string[];\n aminoAcidInsertions?: string[];\n }"
4279
+ },
4280
+ "default": "{}",
4281
+ "description": "LAPIS filter to apply to all queries. This is used to determine the date range and total counts.",
4282
+ "attribute": "lapisFilter"
4283
+ },
4284
+ {
4285
+ "kind": "field",
4286
+ "name": "queries",
4287
+ "type": {
4288
+ "text": "{\n displayLabel: string;\n countQuery: string;\n coverageQuery: string;\n }[]"
4289
+ },
4290
+ "default": "[]",
4291
+ "description": "Required.\n\nArray of queries to display. Each query has:\n- displayLabel: string - The name to show in the grid row label\n- countQuery: string - Query string to count matches\n- coverageQuery: string - Query string to determine coverage/denominator\n\nBoth queries (count and coverage) are 'advanced queries' as they are defined in LAPIS.",
4292
+ "attribute": "queries"
4293
+ },
4294
+ {
4295
+ "kind": "field",
4296
+ "name": "views",
4297
+ "type": {
4298
+ "text": "'grid'[]"
4299
+ },
4300
+ "default": "['grid']",
4301
+ "description": "A list of tabs with views that this component should provide.",
4302
+ "attribute": "views"
4303
+ },
4304
+ {
4305
+ "kind": "field",
4306
+ "name": "width",
4307
+ "type": {
4308
+ "text": "string"
4309
+ },
4310
+ "default": "'100%'",
4311
+ "description": "The width of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
4312
+ "attribute": "width"
4313
+ },
4314
+ {
4315
+ "kind": "field",
4316
+ "name": "height",
4317
+ "type": {
4318
+ "text": "string | undefined"
4319
+ },
4320
+ "default": "undefined",
4321
+ "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
4322
+ "attribute": "height"
4323
+ },
4324
+ {
4325
+ "kind": "field",
4326
+ "name": "granularity",
4327
+ "type": {
4328
+ "text": "'day' | 'week' | 'month' | 'year'"
4329
+ },
4330
+ "default": "'week'",
4331
+ "description": "The granularity of the time axis.",
4332
+ "attribute": "granularity"
4333
+ },
4334
+ {
4335
+ "kind": "field",
4336
+ "name": "lapisDateField",
4337
+ "type": {
4338
+ "text": "string"
4339
+ },
4340
+ "default": "'date'",
4341
+ "description": "Required.\n\nThe LAPIS field that the data should be aggregated by.\nMust be a field of type `date` in LAPIS.",
4342
+ "attribute": "lapisDateField"
4343
+ },
4344
+ {
4345
+ "kind": "field",
4346
+ "name": "initialMeanProportionInterval",
4347
+ "type": {
4348
+ "text": "{ min: number; max: number }"
4349
+ },
4350
+ "default": "{ min: 0, max: 1 }",
4351
+ "description": "The initial proportion interval for the grid view.\nThe values must be between 0 and 1, inclusive.",
4352
+ "attribute": "initialMeanProportionInterval"
4353
+ },
4354
+ {
4355
+ "kind": "field",
4356
+ "name": "hideGaps",
4357
+ "type": {
4358
+ "text": "boolean | undefined"
4359
+ },
4360
+ "default": "false",
4361
+ "description": "If true, date ranges with no data will be hidden initially; if false, not.\nCan be switched with a button in the toolbar.",
4362
+ "attribute": "hideGaps"
4363
+ },
4364
+ {
4365
+ "kind": "field",
4366
+ "name": "pageSizes",
4367
+ "type": {
4368
+ "text": "number[] | number"
4369
+ },
4370
+ "default": "[10, 20, 30, 40, 50]",
4371
+ "description": "The number of rows per page, which can be selected by the user.",
4372
+ "attribute": "pageSizes"
4373
+ },
4374
+ {
4375
+ "kind": "field",
4376
+ "name": "customColumns",
4377
+ "type": {
4378
+ "text": "{ header: string; values: Record<string, string | number> }[] | undefined"
4379
+ },
4380
+ "default": "undefined",
4381
+ "description": "Custom columns to add to the grid.\nEach column has a header and a map of query displayLabels to values.",
4382
+ "attribute": "customColumns"
4383
+ }
4384
+ ],
4385
+ "events": [
4386
+ {
4387
+ "type": {
4388
+ "text": "CustomEvent<undefined>"
4389
+ },
4390
+ "description": "Fired when the component has finished loading the required data from LAPIS.",
4391
+ "name": "gs-component-finished-loading"
4392
+ }
4393
+ ],
4394
+ "attributes": [
4395
+ {
4396
+ "name": "lapisFilter",
4397
+ "type": {
4398
+ "text": "Record<string, string | string[] | number | null | boolean | undefined> & {\n nucleotideMutations?: string[];\n aminoAcidMutations?: string[];\n nucleotideInsertions?: string[];\n aminoAcidInsertions?: string[];\n }"
4399
+ },
4400
+ "default": "{}",
4401
+ "description": "LAPIS filter to apply to all queries. This is used to determine the date range and total counts.",
4402
+ "fieldName": "lapisFilter"
4403
+ },
4404
+ {
4405
+ "name": "queries",
4406
+ "type": {
4407
+ "text": "{\n displayLabel: string;\n countQuery: string;\n coverageQuery: string;\n }[]"
4408
+ },
4409
+ "default": "[]",
4410
+ "description": "Required.\n\nArray of queries to display. Each query has:\n- displayLabel: string - The name to show in the grid row label\n- countQuery: string - Query string to count matches\n- coverageQuery: string - Query string to determine coverage/denominator\n\nBoth queries (count and coverage) are 'advanced queries' as they are defined in LAPIS.",
4411
+ "fieldName": "queries"
4412
+ },
4413
+ {
4414
+ "name": "views",
4415
+ "type": {
4416
+ "text": "'grid'[]"
4417
+ },
4418
+ "default": "['grid']",
4419
+ "description": "A list of tabs with views that this component should provide.",
4420
+ "fieldName": "views"
4421
+ },
4422
+ {
4423
+ "name": "width",
4424
+ "type": {
4425
+ "text": "string"
4426
+ },
4427
+ "default": "'100%'",
4428
+ "description": "The width of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
4429
+ "fieldName": "width"
4430
+ },
4431
+ {
4432
+ "name": "height",
4433
+ "type": {
4434
+ "text": "string | undefined"
4435
+ },
4436
+ "default": "undefined",
4437
+ "description": "The height of the component.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.",
4438
+ "fieldName": "height"
4439
+ },
4440
+ {
4441
+ "name": "granularity",
4442
+ "type": {
4443
+ "text": "'day' | 'week' | 'month' | 'year'"
4444
+ },
4445
+ "default": "'week'",
4446
+ "description": "The granularity of the time axis.",
4447
+ "fieldName": "granularity"
4448
+ },
4449
+ {
4450
+ "name": "lapisDateField",
4451
+ "type": {
4452
+ "text": "string"
4453
+ },
4454
+ "default": "'date'",
4455
+ "description": "Required.\n\nThe LAPIS field that the data should be aggregated by.\nMust be a field of type `date` in LAPIS.",
4456
+ "fieldName": "lapisDateField"
4457
+ },
4458
+ {
4459
+ "name": "initialMeanProportionInterval",
4460
+ "type": {
4461
+ "text": "{ min: number; max: number }"
4462
+ },
4463
+ "default": "{ min: 0, max: 1 }",
4464
+ "description": "The initial proportion interval for the grid view.\nThe values must be between 0 and 1, inclusive.",
4465
+ "fieldName": "initialMeanProportionInterval"
4466
+ },
4467
+ {
4468
+ "name": "hideGaps",
4469
+ "type": {
4470
+ "text": "boolean | undefined"
4471
+ },
4472
+ "default": "false",
4473
+ "description": "If true, date ranges with no data will be hidden initially; if false, not.\nCan be switched with a button in the toolbar.",
4474
+ "fieldName": "hideGaps"
4475
+ },
4476
+ {
4477
+ "name": "pageSizes",
4478
+ "type": {
4479
+ "text": "number[] | number"
4480
+ },
4481
+ "default": "[10, 20, 30, 40, 50]",
4482
+ "description": "The number of rows per page, which can be selected by the user.",
4483
+ "fieldName": "pageSizes"
4484
+ },
4485
+ {
4486
+ "name": "customColumns",
4487
+ "type": {
4488
+ "text": "{ header: string; values: Record<string, string | number> }[] | undefined"
4489
+ },
4490
+ "default": "undefined",
4491
+ "description": "Custom columns to add to the grid.\nEach column has a header and a map of query displayLabels to values.",
4492
+ "fieldName": "customColumns"
4493
+ }
4494
+ ],
4495
+ "superclass": {
4496
+ "name": "PreactLitAdapterWithGridJsStyles",
4497
+ "module": "/src/web-components/PreactLitAdapterWithGridJsStyles"
4498
+ },
4499
+ "tagName": "gs-queries-over-time",
4500
+ "customElement": true
4501
+ }
4502
+ ],
4503
+ "exports": [
4504
+ {
4505
+ "kind": "js",
4506
+ "name": "QueriesOverTimeComponent",
4507
+ "declaration": {
4508
+ "name": "QueriesOverTimeComponent",
4509
+ "module": "src/web-components/visualization/gs-queries-over-time.tsx"
4510
+ }
4511
+ },
4512
+ {
4513
+ "kind": "custom-element-definition",
4514
+ "name": "gs-queries-over-time",
4515
+ "declaration": {
4516
+ "name": "QueriesOverTimeComponent",
4517
+ "module": "src/web-components/visualization/gs-queries-over-time.tsx"
4518
+ }
4519
+ }
4520
+ ]
4521
+ },
4139
4522
  {
4140
4523
  "kind": "javascript-module",
4141
4524
  "path": "src/web-components/visualization/gs-relative-growth-advantage.stories.ts",
@@ -5005,6 +5388,14 @@
5005
5388
  "module": "./gs-mutations-over-time"
5006
5389
  }
5007
5390
  },
5391
+ {
5392
+ "kind": "js",
5393
+ "name": "QueriesOverTimeComponent",
5394
+ "declaration": {
5395
+ "name": "QueriesOverTimeComponent",
5396
+ "module": "./gs-queries-over-time"
5397
+ }
5398
+ },
5008
5399
  {
5009
5400
  "kind": "js",
5010
5401
  "name": "SequencesByLocationComponent",