@genome-spy/core 0.68.0 → 0.69.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.
- package/dist/bundle/index.es.js +12119 -10681
- package/dist/bundle/index.js +119 -119
- package/dist/schema.json +6224 -6319
- package/dist/src/data/dataFlow.d.ts.map +1 -1
- package/dist/src/data/dataFlow.js +10 -0
- package/dist/src/data/flowNode.d.ts +25 -10
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +66 -13
- package/dist/src/data/flowTestUtils.d.ts +2 -2
- package/dist/src/data/flowTestUtils.d.ts.map +1 -1
- package/dist/src/data/flowTestUtils.js +5 -4
- package/dist/src/data/sources/dataSource.js +2 -2
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +11 -10
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +11 -10
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +1 -1
- package/dist/src/data/sources/lazy/tabixSource.d.ts +0 -1
- package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixSource.js +41 -11
- package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
- package/dist/src/data/sources/sequenceSource.js +5 -3
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +7 -3
- package/dist/src/data/transforms/filter.d.ts +4 -4
- package/dist/src/data/transforms/filter.d.ts.map +1 -1
- package/dist/src/data/transforms/filter.js +13 -7
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +11 -6
- package/dist/src/data/transforms/filterScoredLabels.test.d.ts +2 -0
- package/dist/src/data/transforms/filterScoredLabels.test.d.ts.map +1 -0
- package/dist/src/data/transforms/formula.d.ts +4 -4
- package/dist/src/data/transforms/formula.d.ts.map +1 -1
- package/dist/src/data/transforms/formula.js +12 -6
- package/dist/src/data/transforms/measureText.d.ts +2 -2
- package/dist/src/data/transforms/measureText.d.ts.map +1 -1
- package/dist/src/data/transforms/measureText.js +16 -12
- package/dist/src/data/transforms/transform.d.ts +2 -2
- package/dist/src/data/transforms/transform.d.ts.map +1 -1
- package/dist/src/data/transforms/transform.js +3 -3
- package/dist/src/encoder/accessor.d.ts +8 -4
- package/dist/src/encoder/accessor.d.ts.map +1 -1
- package/dist/src/encoder/accessor.js +10 -10
- package/dist/src/encoder/encoder.js +5 -5
- package/dist/src/genome/genome.d.ts +8 -0
- package/dist/src/genome/genome.d.ts.map +1 -1
- package/dist/src/genome/genome.js +16 -1
- package/dist/src/genomeSpy/inputBindingManager.js +1 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +7 -1
- package/dist/src/genomeSpy.js +1 -1
- package/dist/src/gl/glslScaleGenerator.js +1 -1
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +22 -30
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +4 -6
- package/dist/src/paramRuntime/expressionCompiler.d.ts +7 -0
- package/dist/src/paramRuntime/expressionCompiler.d.ts.map +1 -0
- package/dist/src/paramRuntime/expressionCompiler.js +10 -0
- package/dist/src/paramRuntime/expressionRef.d.ts +20 -0
- package/dist/src/paramRuntime/expressionRef.d.ts.map +1 -0
- package/dist/src/paramRuntime/expressionRef.js +95 -0
- package/dist/src/paramRuntime/expressionRef.test.d.ts +2 -0
- package/dist/src/paramRuntime/expressionRef.test.d.ts.map +1 -0
- package/dist/src/paramRuntime/graphRuntime.d.ts +176 -0
- package/dist/src/paramRuntime/graphRuntime.d.ts.map +1 -0
- package/dist/src/paramRuntime/graphRuntime.js +628 -0
- package/dist/src/paramRuntime/graphRuntime.test.d.ts +2 -0
- package/dist/src/paramRuntime/graphRuntime.test.d.ts.map +1 -0
- package/dist/src/paramRuntime/index.d.ts +9 -0
- package/dist/src/paramRuntime/index.d.ts.map +1 -0
- package/dist/src/paramRuntime/index.js +8 -0
- package/dist/src/paramRuntime/lifecycleRegistry.d.ts +27 -0
- package/dist/src/paramRuntime/lifecycleRegistry.d.ts.map +1 -0
- package/dist/src/paramRuntime/lifecycleRegistry.js +54 -0
- package/dist/src/paramRuntime/paramRuntime.d.ts +165 -0
- package/dist/src/paramRuntime/paramRuntime.d.ts.map +1 -0
- package/dist/src/paramRuntime/paramRuntime.js +222 -0
- package/dist/src/paramRuntime/paramRuntime.test.d.ts +2 -0
- package/dist/src/paramRuntime/paramRuntime.test.d.ts.map +1 -0
- package/dist/src/paramRuntime/paramStore.d.ts +68 -0
- package/dist/src/paramRuntime/paramStore.d.ts.map +1 -0
- package/dist/src/paramRuntime/paramStore.js +148 -0
- package/dist/src/paramRuntime/paramStore.test.d.ts +2 -0
- package/dist/src/paramRuntime/paramStore.test.d.ts.map +1 -0
- package/dist/src/paramRuntime/paramUtils.d.ts +86 -0
- package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -0
- package/dist/src/paramRuntime/paramUtils.js +272 -0
- package/dist/src/paramRuntime/selectionStore.d.ts +6 -0
- package/dist/src/paramRuntime/selectionStore.d.ts.map +1 -0
- package/dist/src/paramRuntime/selectionStore.js +13 -0
- package/dist/src/paramRuntime/types.d.ts +16 -0
- package/dist/src/paramRuntime/types.d.ts.map +1 -0
- package/dist/src/paramRuntime/types.js +25 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +164 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -0
- package/dist/src/paramRuntime/viewParamRuntime.js +443 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +6 -3
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
- package/dist/src/scales/scaleInstanceManager.js +17 -11
- package/dist/src/scales/scaleResolution.d.ts +1 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +7 -1
- package/dist/src/selection/selection.js +1 -1
- package/dist/src/spec/coreSchemaRoot.d.ts +53 -0
- package/dist/src/spec/root.d.ts +1 -1
- package/dist/src/spec/view.d.ts +114 -33
- package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
- package/dist/src/tooltip/dataTooltipHandler.js +23 -32
- package/dist/src/tooltip/dataTooltipHandler.test.d.ts +2 -0
- package/dist/src/tooltip/dataTooltipHandler.test.d.ts.map +1 -0
- package/dist/src/tooltip/flattenDatumRows.d.ts +13 -0
- package/dist/src/tooltip/flattenDatumRows.d.ts.map +1 -0
- package/dist/src/tooltip/flattenDatumRows.js +47 -0
- package/dist/src/tooltip/flattenDatumRows.test.d.ts +2 -0
- package/dist/src/tooltip/flattenDatumRows.test.d.ts.map +1 -0
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
- package/dist/src/tooltip/refseqGeneTooltipHandler.js +7 -1
- package/dist/src/tooltip/tooltipContext.d.ts +13 -0
- package/dist/src/tooltip/tooltipContext.d.ts.map +1 -0
- package/dist/src/tooltip/tooltipContext.js +543 -0
- package/dist/src/tooltip/tooltipContext.test.d.ts +2 -0
- package/dist/src/tooltip/tooltipContext.test.d.ts.map +1 -0
- package/dist/src/tooltip/tooltipHandler.d.ts +40 -1
- package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -1
- package/dist/src/tooltip/tooltipHandler.ts +62 -1
- package/dist/src/types/encoder.d.ts +1 -1
- package/dist/src/utils/inputBinding.d.ts +10 -2
- package/dist/src/utils/inputBinding.d.ts.map +1 -1
- package/dist/src/utils/inputBinding.js +12 -3
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.js +12 -3
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +8 -3
- package/dist/src/view/gridView/selectionRect.d.ts +6 -10
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +3 -20
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +4 -2
- package/dist/src/view/multiscale.d.ts +35 -0
- package/dist/src/view/multiscale.d.ts.map +1 -0
- package/dist/src/view/multiscale.js +233 -0
- package/dist/src/view/multiscale.test.d.ts +2 -0
- package/dist/src/view/multiscale.test.d.ts.map +1 -0
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +10 -4
- package/dist/src/view/view.d.ts +5 -4
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +223 -28
- package/dist/src/view/viewFactory.d.ts +0 -12
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +35 -24
- package/dist/src/view/viewParamRuntime.test.d.ts +2 -0
- package/dist/src/view/viewParamRuntime.test.d.ts.map +1 -0
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +8 -5
- package/package.json +3 -3
- package/dist/src/spec/sampleView.d.ts +0 -197
- package/dist/src/view/paramMediator.d.ts +0 -168
- package/dist/src/view/paramMediator.d.ts.map +0 -1
- package/dist/src/view/paramMediator.js +0 -545
- package/dist/src/view/paramMediator.test.d.ts +0 -2
- package/dist/src/view/paramMediator.test.d.ts.map +0 -1
package/dist/src/spec/view.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
} from "./mark.js";
|
|
17
17
|
import { ExprRef } from "./parameter.js";
|
|
18
18
|
import { Title } from "./title.js";
|
|
19
|
-
import { SampleSpec } from "./sampleView.js";
|
|
20
19
|
import { Parameter } from "./parameter.js";
|
|
21
20
|
|
|
22
21
|
export interface SizeDef {
|
|
@@ -46,19 +45,33 @@ export interface FacetMapping {
|
|
|
46
45
|
* The opacity is interpolated between the specified stops.
|
|
47
46
|
*/
|
|
48
47
|
export interface DynamicOpacity {
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The positional channel whose scale domain controls the opacity.
|
|
50
|
+
* If set to `"auto"`, both `x` and `y` scales may contribute.
|
|
51
|
+
*
|
|
52
|
+
* If omitted, `x` is used when available and `y` is used as a fallback.
|
|
53
|
+
*/
|
|
54
|
+
channel?: PrimaryPositionalChannel | "auto";
|
|
50
55
|
|
|
51
56
|
/**
|
|
52
|
-
*
|
|
57
|
+
* Opacity stops expressed as units (base pairs, for example) per pixel.
|
|
58
|
+
* The values must be positive.
|
|
59
|
+
*
|
|
60
|
+
* Each stop is paired with an opacity in `values` at the same index.
|
|
61
|
+
* Stops can be constants or expression references.
|
|
53
62
|
*/
|
|
54
|
-
unitsPerPixel:
|
|
63
|
+
unitsPerPixel: NumericStopDef[];
|
|
55
64
|
|
|
56
65
|
/**
|
|
57
|
-
* Opacity values that match the given stops.
|
|
66
|
+
* Opacity values that match the given `unitsPerPixel` stops.
|
|
67
|
+
*
|
|
68
|
+
* Values outside the stop range are clamped to the nearest stop.
|
|
58
69
|
*/
|
|
59
70
|
values: number[];
|
|
60
71
|
}
|
|
61
72
|
|
|
73
|
+
export type NumericStopDef = number | ExprRef;
|
|
74
|
+
|
|
62
75
|
export type ViewOpacityDef = number | DynamicOpacity | ExprRef;
|
|
63
76
|
|
|
64
77
|
export interface Step {
|
|
@@ -239,18 +252,35 @@ export interface ViewSpecBase extends ResolveSpec {
|
|
|
239
252
|
|
|
240
253
|
export interface DynamicOpacitySpec {
|
|
241
254
|
/**
|
|
242
|
-
* Opacity of the view and all its children.
|
|
243
|
-
*
|
|
255
|
+
* Opacity of the view and all its children.
|
|
256
|
+
*
|
|
257
|
+
* This can be:
|
|
244
258
|
*
|
|
245
|
-
*
|
|
259
|
+
* - a fixed number between `0` and `1`
|
|
260
|
+
* - an expression reference (`ExprRef`)
|
|
261
|
+
* - a `DynamicOpacity` definition for zoom-dependent opacity
|
|
246
262
|
*
|
|
247
|
-
*
|
|
263
|
+
* Dynamic opacity is useful for semantic zooming where layers are faded in
|
|
264
|
+
* and out as the user zooms.
|
|
265
|
+
*
|
|
266
|
+
* Example:
|
|
267
|
+
*
|
|
268
|
+
* ```json
|
|
269
|
+
* "opacity": {
|
|
270
|
+
* "unitsPerPixel": [100000, 40000],
|
|
271
|
+
* "values": [0, 1]
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* In this example, the view fades in while zooming in from 100 000 to
|
|
276
|
+
* 40 000 units per pixel.
|
|
277
|
+
*
|
|
278
|
+
* __Default value:__ `1.0`
|
|
248
279
|
*/
|
|
249
280
|
opacity?: ViewOpacityDef;
|
|
250
281
|
}
|
|
251
282
|
|
|
252
|
-
export interface UnitSpec
|
|
253
|
-
extends ViewSpecBase, DynamicOpacitySpec, AggregateSamplesSpec {
|
|
283
|
+
export interface UnitSpec extends ViewSpecBase, DynamicOpacitySpec {
|
|
254
284
|
/**
|
|
255
285
|
* The background of the view, including fill, stroke, and stroke width.
|
|
256
286
|
*/
|
|
@@ -262,20 +292,66 @@ export interface UnitSpec
|
|
|
262
292
|
mark: MarkType | MarkProps;
|
|
263
293
|
}
|
|
264
294
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
295
|
+
export interface LayerSpec extends ViewSpecBase, DynamicOpacitySpec {
|
|
296
|
+
view?: ViewBackground;
|
|
297
|
+
layer: (LayerSpec | UnitSpec | MultiscaleSpec | ImportSpec)[];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export interface MultiscaleStops {
|
|
301
|
+
/**
|
|
302
|
+
* The metric used to evaluate zoom stops.
|
|
303
|
+
*
|
|
304
|
+
* __Default value:__ `"unitsPerPixel"`
|
|
305
|
+
*/
|
|
306
|
+
metric?: "unitsPerPixel";
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Stop values in descending order.
|
|
310
|
+
*/
|
|
311
|
+
values: NumericStopDef[];
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Which positional channel controls the stop metric.
|
|
315
|
+
*
|
|
316
|
+
* - `"auto"` averages `x` and `y` when both are available.
|
|
317
|
+
* - `"x"` uses only the `x` channel.
|
|
318
|
+
* - `"y"` uses only the `y` channel.
|
|
319
|
+
*
|
|
320
|
+
* __Default value:__ `"auto"`
|
|
321
|
+
*/
|
|
322
|
+
channel?: PrimaryPositionalChannel | "auto";
|
|
323
|
+
|
|
268
324
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
325
|
+
* Relative transition width around each stop.
|
|
326
|
+
*
|
|
327
|
+
* For each stop value `s`, the fade transition is evaluated in the range:
|
|
328
|
+
*
|
|
329
|
+
* - upper edge: `s * (1 + fade)`
|
|
330
|
+
* - lower edge: `s * (1 - fade)`
|
|
331
|
+
*
|
|
332
|
+
* __Default value:__ `0.5`
|
|
271
333
|
*/
|
|
272
|
-
|
|
334
|
+
fade?: number;
|
|
273
335
|
}
|
|
274
336
|
|
|
275
|
-
export
|
|
276
|
-
|
|
337
|
+
export type MultiscaleStopsDef = NumericStopDef[] | MultiscaleStops;
|
|
338
|
+
|
|
339
|
+
export interface MultiscaleSpec extends ViewSpecBase, DynamicOpacitySpec {
|
|
277
340
|
view?: ViewBackground;
|
|
278
|
-
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Child views ordered from zoomed-out to zoomed-in detail levels.
|
|
344
|
+
*/
|
|
345
|
+
multiscale: (LayerSpec | UnitSpec | MultiscaleSpec | ImportSpec)[];
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Stop definition that controls transitions between the multiscale levels.
|
|
349
|
+
*
|
|
350
|
+
* - `number[]` is shorthand for `{ metric: "unitsPerPixel", values: ... }`
|
|
351
|
+
* - `(number | ExprRef)[]` supports mixed constants and expressions
|
|
352
|
+
* - Object form allows configuring metric, channel, and fade.
|
|
353
|
+
*/
|
|
354
|
+
stops: MultiscaleStopsDef;
|
|
279
355
|
}
|
|
280
356
|
|
|
281
357
|
export interface FacetSpec extends ViewSpecBase {
|
|
@@ -313,25 +389,23 @@ export interface ResolveSpec {
|
|
|
313
389
|
>;
|
|
314
390
|
}
|
|
315
391
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
| VConcatSpec
|
|
321
|
-
| HConcatSpec
|
|
322
|
-
| ConcatSpec
|
|
323
|
-
| UnitSpec
|
|
324
|
-
) &
|
|
325
|
-
ResolveSpec;
|
|
392
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
393
|
+
export interface ViewSpecExtensions {}
|
|
394
|
+
|
|
395
|
+
export type ViewSpecExtension = ViewSpecExtensions[keyof ViewSpecExtensions];
|
|
326
396
|
|
|
327
|
-
export type
|
|
397
|
+
export type CoreViewSpec =
|
|
328
398
|
| UnitSpec
|
|
329
399
|
| LayerSpec
|
|
400
|
+
| MultiscaleSpec
|
|
330
401
|
// | FacetSpec
|
|
331
402
|
| VConcatSpec
|
|
332
403
|
| HConcatSpec
|
|
333
|
-
| ConcatSpec
|
|
334
|
-
|
|
404
|
+
| ConcatSpec;
|
|
405
|
+
|
|
406
|
+
export type ContainerSpec = (CoreViewSpec | ViewSpecExtension) & ResolveSpec;
|
|
407
|
+
|
|
408
|
+
export type ViewSpec = CoreViewSpec | ViewSpecExtension;
|
|
335
409
|
|
|
336
410
|
export interface UrlImport {
|
|
337
411
|
/**
|
|
@@ -362,6 +436,13 @@ export interface ImportSpec {
|
|
|
362
436
|
*/
|
|
363
437
|
params?: Parameter[] | Record<string, any>;
|
|
364
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Overrides the visibility of the imported view.
|
|
441
|
+
*
|
|
442
|
+
* If not specified, the imported specification's `visible` property is used.
|
|
443
|
+
*/
|
|
444
|
+
visible?: boolean;
|
|
445
|
+
|
|
365
446
|
/**
|
|
366
447
|
* The method to import a specification.
|
|
367
448
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?:
|
|
1
|
+
export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: import("./tooltipHandler.js").TooltipHandlerParams, context?: import("./tooltipHandler.js").TooltipContext): Promise<string | import("lit-html").TemplateResult | HTMLElement>;
|
|
2
2
|
//# sourceMappingURL=dataTooltipHandler.d.ts.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { html } from "lit";
|
|
2
2
|
import formatObject from "../utils/formatObject.js";
|
|
3
|
+
import { flattenDatumRows } from "./flattenDatumRows.js";
|
|
4
|
+
import createTooltipContext from "./tooltipContext.js";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @type {import("./tooltipHandler.js").TooltipHandler}
|
|
6
8
|
*/
|
|
7
|
-
export default async function dataTooltipHandler(datum, mark, params) {
|
|
9
|
+
export default async function dataTooltipHandler(datum, mark, params, context) {
|
|
8
10
|
/**
|
|
9
11
|
* @param {string} key
|
|
10
12
|
* @param {object} datum
|
|
@@ -30,41 +32,30 @@ export default async function dataTooltipHandler(datum, mark, params) {
|
|
|
30
32
|
return "";
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const entriesToHtml = (entries, prefix) => {
|
|
40
|
-
const strippedEntries = entries.filter(
|
|
41
|
-
([key, _value]) => !key.startsWith("_")
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
if (strippedEntries.length === 0) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
35
|
+
const tooltipContext = context ?? createTooltipContext(datum, mark, params);
|
|
36
|
+
const rawRows = tooltipContext.flattenDatumRows
|
|
37
|
+
? tooltipContext.flattenDatumRows()
|
|
38
|
+
: flattenDatumRows(datum);
|
|
39
|
+
const genomicRows = tooltipContext.genomicRows ?? [];
|
|
40
|
+
const hiddenRowKeys = new Set(tooltipContext.hiddenRowKeys ?? []);
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Object.entries(value),
|
|
52
|
-
(prefix ? prefix : "") + key + "."
|
|
53
|
-
)}`
|
|
54
|
-
: html`
|
|
55
|
-
<tr>
|
|
56
|
-
<th>${prefix}${key}</th>
|
|
57
|
-
<td>${formatObject(value)} ${legend(key, datum)}</td>
|
|
58
|
-
</tr>
|
|
59
|
-
`
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const tableContents = entriesToHtml(Object.entries(datum));
|
|
64
|
-
if (!tableContents) {
|
|
42
|
+
const visibleRawRows = rawRows.filter((row) => !hiddenRowKeys.has(row.key));
|
|
43
|
+
const orderedRows = [...genomicRows, ...visibleRawRows];
|
|
44
|
+
if (!orderedRows.length) {
|
|
65
45
|
return;
|
|
66
46
|
}
|
|
67
47
|
|
|
48
|
+
const tableContents = orderedRows.map((row) => {
|
|
49
|
+
const value = formatObject(row.value);
|
|
50
|
+
const valueLegend = legend(row.key, datum);
|
|
51
|
+
return html`
|
|
52
|
+
<tr>
|
|
53
|
+
<th>${row.key}</th>
|
|
54
|
+
<td>${value} ${valueLegend}</td>
|
|
55
|
+
</tr>
|
|
56
|
+
`;
|
|
57
|
+
});
|
|
58
|
+
|
|
68
59
|
const table = html`
|
|
69
60
|
<table class="attributes">
|
|
70
61
|
${tableContents}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTooltipHandler.test.d.ts","sourceRoot":"","sources":["../../../src/tooltip/dataTooltipHandler.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("./tooltipHandler.js").TooltipRow} TooltipRow
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Flattens an object into tooltip rows using dot-separated keys.
|
|
6
|
+
* Keys starting with "_" are omitted.
|
|
7
|
+
*
|
|
8
|
+
* @param {Record<string, any>} datum
|
|
9
|
+
* @returns {TooltipRow[]}
|
|
10
|
+
*/
|
|
11
|
+
export function flattenDatumRows(datum: Record<string, any>): TooltipRow[];
|
|
12
|
+
export type TooltipRow = import("./tooltipHandler.js").TooltipRow;
|
|
13
|
+
//# sourceMappingURL=flattenDatumRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenDatumRows.d.ts","sourceRoot":"","sources":["../../../src/tooltip/flattenDatumRows.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,wCAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,UAAU,EAAE,CAOxB;yBAfY,OAAO,qBAAqB,EAAE,UAAU"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("./tooltipHandler.js").TooltipRow} TooltipRow
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Flattens an object into tooltip rows using dot-separated keys.
|
|
7
|
+
* Keys starting with "_" are omitted.
|
|
8
|
+
*
|
|
9
|
+
* @param {Record<string, any>} datum
|
|
10
|
+
* @returns {TooltipRow[]}
|
|
11
|
+
*/
|
|
12
|
+
export function flattenDatumRows(datum) {
|
|
13
|
+
/** @type {TooltipRow[]} */
|
|
14
|
+
const rows = [];
|
|
15
|
+
collectRows(Object.entries(datum), rows);
|
|
16
|
+
return rows;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {[string, any][]} entries
|
|
21
|
+
* @param {TooltipRow[]} output
|
|
22
|
+
* @param {string} [prefix]
|
|
23
|
+
*/
|
|
24
|
+
function collectRows(entries, output, prefix) {
|
|
25
|
+
for (const [key, value] of entries) {
|
|
26
|
+
if (key.startsWith("_")) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
value !== null &&
|
|
32
|
+
typeof value === "object" &&
|
|
33
|
+
!Array.isArray(value)
|
|
34
|
+
) {
|
|
35
|
+
collectRows(
|
|
36
|
+
Object.entries(value),
|
|
37
|
+
output,
|
|
38
|
+
(prefix ? prefix : "") + key + "."
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
output.push({
|
|
42
|
+
key: (prefix ? prefix : "") + key,
|
|
43
|
+
value: value,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenDatumRows.test.d.ts","sourceRoot":"","sources":["../../../src/tooltip/flattenDatumRows.test.js"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?:
|
|
1
|
+
export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: import("./tooltipHandler.js").TooltipHandlerParams, context?: import("./tooltipHandler.js").TooltipContext): Promise<string | import("lit-html").TemplateResult | HTMLElement>;
|
|
2
2
|
//# sourceMappingURL=refseqGeneTooltipHandler.d.ts.map
|
|
@@ -23,12 +23,18 @@ export default async function refseqGeneTooltipHandler(
|
|
|
23
23
|
) {
|
|
24
24
|
const symbol = datum.symbol;
|
|
25
25
|
|
|
26
|
+
/** @type {Record<string, string>} */
|
|
26
27
|
const term = {
|
|
27
28
|
...defaultParams,
|
|
28
|
-
...params,
|
|
29
29
|
GENE: symbol,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
for (const [key, value] of Object.entries(params)) {
|
|
33
|
+
if (typeof value === "string") {
|
|
34
|
+
term[key] = value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
let summary =
|
|
33
39
|
symbolSummaryCache.get(symbol) ??
|
|
34
40
|
(await debouncedFetchGeneSummary(term));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a stable context object for tooltip handlers.
|
|
3
|
+
*
|
|
4
|
+
* @param {Record<string, any>} datum
|
|
5
|
+
* @param {import("../marks/mark.js").default} mark
|
|
6
|
+
* @param {import("./tooltipHandler.js").TooltipHandlerParams} [params]
|
|
7
|
+
* @returns {TooltipContext}
|
|
8
|
+
*/
|
|
9
|
+
export default function createTooltipContext(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: import("./tooltipHandler.js").TooltipHandlerParams): TooltipContext;
|
|
10
|
+
export type TooltipContext = import("./tooltipHandler.js").TooltipContext;
|
|
11
|
+
export type TooltipGenomicDisplayMode = import("./tooltipHandler.js").TooltipGenomicDisplayMode;
|
|
12
|
+
export type TooltipRow = import("./tooltipHandler.js").TooltipRow;
|
|
13
|
+
//# sourceMappingURL=tooltipContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltipContext.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltipContext.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,oDALW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QACnB,OAAO,kBAAkB,EAAE,OAAO,WAClC,OAAO,qBAAqB,EAAE,oBAAoB,GAChD,cAAc,CAgE1B;6BAhGY,OAAO,qBAAqB,EAAE,cAAc;wCAC5C,OAAO,qBAAqB,EAAE,yBAAyB;yBACvD,OAAO,qBAAqB,EAAE,UAAU"}
|